#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 2e4+10, M = 1e6+10;
int T, n, a[N], c[N];
ll f[N][N][2], ans;

inline int read(){
    int x=0, f=1;
    char ch = getchar();
    while(ch<'0'||ch>'9'){if(ch == '-')f=-1; ch = getchar();}
    while(ch>='0'||ch<='9'){x = (x<<1)+(x<<3)+(ch-'0'); ch = getchar();}
    return x*f;
}


int main(){
    freopen("color.in", "r", stdin);
    freopen("color.out", "w", stdout);
    T = read();
    while(T--){
        memset(a, 0, sizeof(a));
        memset(f, 0, sizeof(f));
        n = read();
        for(int i=1; i<=n; i++){
            a[i] = read();
        }
        
        ans = max(f[1][n][1], f[1][n][0]);
        printf("%d", ans);
    }
    return 0;
}
